const { Schema } = require("./config");
const ObjectId = Schema.Types.ObjectId;   //mogoDB的文档唯一主键
const CommentSchema = new Schema({
  //内容
  comment: String,
  //关联用户表
  form: {
      type: ObjectId,   //类型必须是MongoDB的ID值
      ref: "users",     //关联的表的名字
  },
  //关联article集合
  article: {
    type: ObjectId,
    ref: "articles"
  }


},{
  versionKey:false,
  timestamps:{
    createdAt:"createdTime",
    updateAt:''
  }
});

module.exports = CommentSchema;